<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@include file="/static/common/taglib.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>日志统计</title>
    <%@include file="../../public/commonCss.jsp" %>
    <%@include file="../../public/commonJs.jsp" %>
</head>
<body ms-controller="main">
<div id="wrapper">
    <div class="boxtoolbar whiteBox actionArea contentbox">
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text"  ms-duplex="startDate" class="layui-input Wdate"
                       onClick="WdatePicker({readOnly:true,maxDate:'%y-%M-%d'})"/>
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text" style="width:250px" ms-duplex="searchKey"
                       placeholder="搜索、人员姓名、人员编号、车组号" class="layui-input"/>
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <button class="layui-btn layui-btn-normal" ms-on-click="loadSearchData()">搜索</button>
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <button class="layui-btn layui-btn-normal" ms-on-click="exportData()">导出Excel</button>
            </div>
        </div>
    </div>
    <div class="boxmain whiteBox lrbox" style="margin-top:-90px">
        <div class="lrboxmain borderL" style="margin-left:0%">
            <div class="from-header borderB contentbox">
                <div>
                    <span class="font14"> 所属分类:</span><a id="category"><span class=" fontOrange2">登陆日志统计</span></a>
                </div>
            </div>
            <div class="from-body withheader contentbox" style=" overflow: auto;">
                <table class="layui-table">
                    <thead>
                    <tr align="center">
                        <th>行号</th>
                        <th>人员编号</th>
                        <th>人员姓名</th>
                        <th>登录车次</th>
                        <th>车组号</th>
                        <th>车型</th>
                        <th>交路名称</th>
                        <th>登录时间</th>
                        <th>登录版本号</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr align="center" ms-repeat="tableData">
                        <td>{{$index+1}}</td>
                        <td>{{el.userNum}}</td>
                        <td>{{el.userName}}</td>
                        <td>{{el.trainCode}}</td>
                        <td>{{el.trainNum}}</td>
                        <td>{{el.trainType}}</td>
                        <td>{{el.roadName}}</td>
                        <td>{{el.loginTime}}</td>
                        <td>{{el.loginVersion}}</td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <!-- whitebox -->
</div>
<script type="text/javascript">
    var vm;
    avalon.ready(function () {
        vm = avalon.define({
            $id: "main",
            startDate: "${startDate}",
            tableData: [],//表格数据
            searchKey: ''
        })
        avalon.scan();
        loadTableData();
    });
    function loadSearchData() {
        loadTableData();
    }
    //加载表格数据
    function loadTableData() {
        var dataStr = {searchKey: vm.$model.searchKey, startDate: vm.$model.startDate};
        $.ajax({
            type: 'post',
            url: '${ctx}/loginInfoController/selectAllLog.action',
            data: dataStr,
            dataType: "json",
            timeout: 10000,
            beforeSend: function () {
                layui.layer.msg('正在加载...', {time: 0, icon: 16, shade: 0.02});
            },
            success: function (data) {
                closeDialog();
                vm.tableData = data.data;
            }
        });

    }
    //导出Excel
    function exportData() {
        window.location.href = '${ctx}/logController/exportExcel.action?startDate=' + vm.$model.startDate;
    }
</script>
</body>
</html>